UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M0Y4VjgqesRJOfJa+rae6D+E9zx3JF8AlGl8J2IX+cM='
WHERE
key_id = '6318d5e813c2637de39bfaaf71affcdd56e437dc53664134eae248352135393c'
AND (
token = 'M0Y4VjgqesRJOfJa+rae6D+E9zx3JF8AlGl8J2IX+cM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)