UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4bMdzpDn3kHC0a2vhJA3RPNja4qZbbsyd7ZZ3PpBUyU='
WHERE
key_id = 'd17412e28991958b2286cd780c9288075a71f80bf47672ea1cabb491c4a28e7a'
AND (
token = '4bMdzpDn3kHC0a2vhJA3RPNja4qZbbsyd7ZZ3PpBUyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)