UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nN6c29UcG0iiZXYr9+1/hz5lRSQbeKfkfbfEVQgdz7k='
WHERE
key_id = '89c1a3975c22e3248ba77d8ffe2b48eaea4c2705bd5d1728195239c8677421a4'
AND (
token = 'nN6c29UcG0iiZXYr9+1/hz5lRSQbeKfkfbfEVQgdz7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)