UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HSV5Qc5BPrez6M6vo7CA5jRfLdw0rSh+83J08jA0xCw='
WHERE
key_id = '5045eff01e635ccc7634f8221bd5a9132df62a0944ad252be1244ee6fcb063f9'
AND (
token = 'HSV5Qc5BPrez6M6vo7CA5jRfLdw0rSh+83J08jA0xCw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)