UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wAc+LftO0wLCljH/sEsf6PAAQ4AX/U30oiqxDV/GqKQ=' 
WHERE 
  key_id = '44a36caeeacbce90d2d86837cf691b8362e546692d148dea39363df6ad978643' 
  AND (
    token = 'wAc+LftO0wLCljH/sEsf6PAAQ4AX/U30oiqxDV/GqKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039