UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LB7exncd4jkEHgOt0ySopuW8D4RRFC9Q1wfEgFAlLp0='
WHERE
key_id = '84b694950525939a85d00ddfdd30236afbc598ccb9a03f863bdd1bee6499bd46'
AND (
token = 'LB7exncd4jkEHgOt0ySopuW8D4RRFC9Q1wfEgFAlLp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)