UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'syOozPLqlcWemScxPwyH06Z3H84vjHOSheVTzEPtKPc=' 
WHERE 
  key_id = '8633337eec04ca4d62fe3205124bb747b995684c0592a7b54cd0e74fad7b8654' 
  AND (
    token = 'syOozPLqlcWemScxPwyH06Z3H84vjHOSheVTzEPtKPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040