UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kqRoWuD53Z45bo+3RThXya1vaHHe1kuELI2OXWqgxcA=' 
WHERE 
  key_id = '022417a33d436b78f04f3b14120b85e59fb14200f7400eb86b5b864f7e6710f5' 
  AND (
    token = 'kqRoWuD53Z45bo+3RThXya1vaHHe1kuELI2OXWqgxcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017