UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YW/MgrIUFzn0NX/rdAofSzKJK1wGb6ZpOzh1JfJpWco='
WHERE
key_id = 'bd97130cfc0945783edc98eb4c1ef85760f7182ffa9ba89e85035cca51d6055c'
AND (
token = 'YW/MgrIUFzn0NX/rdAofSzKJK1wGb6ZpOzh1JfJpWco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)