UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b8J/JTSeJMRCMQh9+22Vac4+mzSYfvWoaDiCl8sws24='
WHERE
key_id = 'e2797bfdd4a7f757e3e0e2c6d0fb7f0167374b66798aa8c20348806aa1d586db'
AND (
token = 'b8J/JTSeJMRCMQh9+22Vac4+mzSYfvWoaDiCl8sws24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)