UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZflCsU6C+wjPSYEF+GCiTJFwN5kh7C1PKeNENM7jMi0=' 
WHERE 
  key_id = '5314170a2442574cf7550a69f96e5cafd658d4490d693708e65ca95288c29aff' 
  AND (
    token = 'ZflCsU6C+wjPSYEF+GCiTJFwN5kh7C1PKeNENM7jMi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015