UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bYLG9jBCvg8mth8AGDChsI7+mSEGIF/DUzo93dFLsUM='
WHERE
key_id = 'e1cc9dfbfa5950aa189b16cc1a9dd71b7ef0f4a2dcd7bb7a1ce22e1f0da2c1b8'
AND (
token = 'bYLG9jBCvg8mth8AGDChsI7+mSEGIF/DUzo93dFLsUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)