UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bnucv0d2S6RiPRWKPByvlhDNzAzzAjcsTq1BVwBYvN4='
WHERE
key_id = '665c059f1091075f3b0b62b2f7579e41be576da778b29546b6a60f88a78ff884'
AND (
token = 'bnucv0d2S6RiPRWKPByvlhDNzAzzAjcsTq1BVwBYvN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)