UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aQMQ54mKiSSzfU81aUJYSgT2KM8EKG1nCRetkQA42vI='
WHERE
key_id = 'd23c33f80aee0feeeb58ef21fc308519b2033d070020b776869254628f9c37ee'
AND (
token = 'aQMQ54mKiSSzfU81aUJYSgT2KM8EKG1nCRetkQA42vI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)