UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WrOmy2vNqREIql6BwD8dWl3gAOPUw/5sGd37RA9I/+E='
WHERE
key_id = 'b6644aee5630ff6c93498430b4f2b531cd806e4e8c1249414d2d82f64721ca2b'
AND (
token = 'WrOmy2vNqREIql6BwD8dWl3gAOPUw/5sGd37RA9I/+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)