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