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

Query time 0.00034