UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RIT3WOcd3nSrgORaKjISuCjaIpFkgIZHmnG4LkkwwC8='
WHERE
key_id = 'dd236806bd954549d64d9b2fec39a57a3fd4619299f2c3b3c2117911995ff27b'
AND (
token = 'RIT3WOcd3nSrgORaKjISuCjaIpFkgIZHmnG4LkkwwC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)