UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bquJB1y5kJHGiRShALZ2w3wR3lvyyeAkgTuw1vWljAA='
WHERE
key_id = '3b7079d0bf87cbcc26a9bcac992d946d8a1b1c7221228ca7403d9c22a0988feb'
AND (
token = 'bquJB1y5kJHGiRShALZ2w3wR3lvyyeAkgTuw1vWljAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)