UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rm1zmYxChMJtKZu+Aukw+T9lE06tPiLx2DkQGimvSjE='
WHERE
key_id = '00082d9bdd8a483718e94e320f6c531a70062119d62b561a445e81bc1fe1ed85'
AND (
token = 'rm1zmYxChMJtKZu+Aukw+T9lE06tPiLx2DkQGimvSjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)