UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kh0AlV3SMsk2X4GevT5OYqlML3LMHYm+hJBe69xC4ZE=' 
WHERE 
  key_id = '1561136cea7db86d87a685cf500cce6aa3b8c382b4c42299a6cd70bf9fd129b2' 
  AND (
    token = 'Kh0AlV3SMsk2X4GevT5OYqlML3LMHYm+hJBe69xC4ZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045