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