UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQ8vPCkJYVus613dm6JszIQLwAliktnyenZHWWO9zTI=' 
WHERE 
  key_id = '09e7f791c1e5e84f76b5eecc81c7763f148ba6e2907078f356416ea26fa573e9' 
  AND (
    token = 'mQ8vPCkJYVus613dm6JszIQLwAliktnyenZHWWO9zTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053