UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pt86PCawzRIA8YNuCIj6YfwHimrbmWgvjoSLKDqnctk=' 
WHERE 
  key_id = 'dfab82e06b78e32f619443987f0be6681b531c3820682d0882ed172b4db7013c' 
  AND (
    token = 'pt86PCawzRIA8YNuCIj6YfwHimrbmWgvjoSLKDqnctk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034