UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hYxIaZXeD5pu/4eZMMcwXHXw3SqyGKm4ooO1imS6k0U='
WHERE
key_id = 'dc03ae53e33ab438346006ab66bd692e0d9c0de97fec5f4b637aa08054dca8ec'
AND (
token = 'hYxIaZXeD5pu/4eZMMcwXHXw3SqyGKm4ooO1imS6k0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)