UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bz4KhQsmjawV6B+0oR3rOjSwKMnvlBy89bhFVR5uXHk='
WHERE
key_id = '42adaadd0ac0a49e562d45f6457f5600e3102180e5f103a14c8aaed4b57bf681'
AND (
token = 'Bz4KhQsmjawV6B+0oR3rOjSwKMnvlBy89bhFVR5uXHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)