UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cfayr4SppBfsT+Xv73C9fhoUqmdottKCfOmJLUrkfzQ='
WHERE
key_id = '9c3914ec7cb92416d8a60980e1acd97de507a2efd303e06060936823173f550c'
AND (
token = 'cfayr4SppBfsT+Xv73C9fhoUqmdottKCfOmJLUrkfzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)