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