UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZraWO2SKvsrNF83ar9KS5XXuJ8Vtr+4wxafkBFGEtoM=' 
WHERE 
  key_id = '9a3220f8285b6b397ad8a4500277acd8014e9e133869d40dab6541d6a8ec05e9' 
  AND (
    token = 'ZraWO2SKvsrNF83ar9KS5XXuJ8Vtr+4wxafkBFGEtoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032