UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gM6Sx81xAGDGzAXJVvGdKAC/hzDqCSAPyN0vRaGZgrY='
WHERE
key_id = 'ccf2b0c664c1191f530bac620784e2c4e813c0f4821522252e63138a3a46c8e2'
AND (
token = 'gM6Sx81xAGDGzAXJVvGdKAC/hzDqCSAPyN0vRaGZgrY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)