UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Fzn5koEkZSWsTW84tA3WqNG68XbCMlSG6HgxgmVfu3k='
WHERE
key_id = '371d064f40bda272c480ae461dad8ce824efaba25958d879303f4d8f7f4a0302'
AND (
token = 'Fzn5koEkZSWsTW84tA3WqNG68XbCMlSG6HgxgmVfu3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)