UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JACz07tv06YvlQ1CNIHRI3uc/D/DHv1mzJbr8zPYvaA='
WHERE
key_id = '0c60345a1edf0bedce968b0572b719f7f7022562716b30238cc42f9a41a7c3e2'
AND (
token = 'JACz07tv06YvlQ1CNIHRI3uc/D/DHv1mzJbr8zPYvaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)