UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Hsm7u2SofDca68AWYAn/ikZYdo2OfKSn0f+5jEVn4w=' 
WHERE 
  key_id = '7901c2eec863a13003ff35710f081c72fa1a5ec090cd84a75821961c92d887f2' 
  AND (
    token = '0Hsm7u2SofDca68AWYAn/ikZYdo2OfKSn0f+5jEVn4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032