UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RM2/MvvHGGO4uz9hMpaPFFt91llcbY2nEemEAIktw+4=' 
WHERE 
  key_id = '7236ed143276acbb3bbc84cb58b035b25035017ca250847765252f32001781c7' 
  AND (
    token = 'RM2/MvvHGGO4uz9hMpaPFFt91llcbY2nEemEAIktw+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016