UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ESUnhIbK0uicwoDAKY/EWNnUR8LaCzoy2iFEQf7Pla0='
WHERE
key_id = '107947817c2027b4792263bc32d75a72018a54c961b3c12261f7b1695a54f697'
AND (
token = 'ESUnhIbK0uicwoDAKY/EWNnUR8LaCzoy2iFEQf7Pla0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)