UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e11GrZsxqK0JGrxAsV6QTXm6jsAzKh+9v/e5AU+15x8='
WHERE
key_id = '9e2438e060d9e08e865b4d699009d29bbb84f2790d444e18bebcffb410a6a51e'
AND (
token = 'e11GrZsxqK0JGrxAsV6QTXm6jsAzKh+9v/e5AU+15x8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)