UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vE++3uBkP5V0aLaLd70c6GrdIiWvhZbCg8VhhNUKJ98=' 
WHERE 
  key_id = '9415ccac2618f6398557dfc73a544f44e90b922e2c03822ca92a46e2c348f07d' 
  AND (
    token = 'vE++3uBkP5V0aLaLd70c6GrdIiWvhZbCg8VhhNUKJ98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026