UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xYpg1jZsSHt0ab2toKg71VXGPsKZMIFRIZZHHc3L5L0='
WHERE
key_id = 'e39a4c0776a38eb3e1b5ab8001c403cf03953fb9fe943920697a3a48298c94c6'
AND (
token = 'xYpg1jZsSHt0ab2toKg71VXGPsKZMIFRIZZHHc3L5L0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)