UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T40lNZNNX/jNEPbn4V5YU9O3afRd04oFlmGDoq8Ale4='
WHERE
key_id = 'bb495ca0101d6b003d9efca3fbc33e240d20ad3aed3b91be9a0dab9aa1ef6f43'
AND (
token = 'T40lNZNNX/jNEPbn4V5YU9O3afRd04oFlmGDoq8Ale4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)