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

Query time 0.00034